package io.renren.modules.miniapp.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.communityService.dto.DbQuestionnaireDTO;
import io.renren.modules.communityService.dto.MiniAppDbQuestionnaireInfoDTO;
import io.renren.modules.communityService.dto.MiniAppDbQuestionnaireListDTO;
import io.renren.modules.communityService.service.DbQuestionnaireService;
import io.renren.modules.communityService.vo.DbQuestionnaireVO;
import io.renren.modules.communityService.vo.MiniAppDbQuestionnaireInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;


/**
 * 问卷调查表
 *
 * @author chenweilong
 * @email 1433471850@qq.com
 * @date 2021-03-21 15:59:43
 */
@RestController
@RequestMapping("miniapp/dbquestionnaire")
@Api(value = "小程序问卷调查",tags = "小程序问卷调查")
public class MiniAppDbQuestionnaireController {
    @Autowired
    private DbQuestionnaireService dbQuestionnaireService;


    /**
     * 问卷调查列表
     */
    @GetMapping("/list")
    @ApiOperation(value = "问卷调查列表",notes = "问卷调查列表")
    public R list(MiniAppDbQuestionnaireListDTO dto){
        PageUtils page = dbQuestionnaireService.queryPage(dto);

        return R.ok().put("page", page);
    }


    /**
     * 问卷调查详情
     */
    @GetMapping("/info")
    @ApiOperation(value = "问卷调查详情",notes = "问卷调查详情")
    public R info(MiniAppDbQuestionnaireInfoDTO dto){
        MiniAppDbQuestionnaireInfoVO vo =  dbQuestionnaireService.info(dto);
        return R.data(vo);
    }



}
